<?php
/*
+-----------------------------------------------------------------------------+
| $Id: *.php 2009-08-18 08:41:22Z Bleakwind $
| Copyright (c) 2003-2010 Bleakwind (www.weaverdream.com)
| http://www.weaverdream.com/
+-----------------------------------------------------------------------------+
*/

if (!defined( 'ENTRY_INDEX')){
    echo "<h1>Forbidden</h1><p>You don't have permission to access on this server.</p>";
    exit;
}

// quicklaunch
if ($ADMIN['iflogin'] == "1") {

    //return_channel_all
    $sys->return_channel_all();
    $t->assign(array(
        "channel_all"       => $sys->channel_all,
        "channel_upper"     => $sys->channel_upper,
    ));
    //////

    // channel_top
    $sys->channel_sub = array();
    $sys->return_channel_sub("0");
    $t->assign(array(
        "channel_top"       => $sys->channel_sub,
    ));
    //////

    // channel_tree
    $sys->channel_tree = array();
    $sys->return_channel_tree();
    $t->assign(array(
        "channel_tree"     => $sys->channel_tree,
    ));
    //////

    // config_sort
    $config_sort = func::db_select(DB_TABLE_CONFIG_SORT, "*", "", "", "cs_rank, cs_id");
    $t->assign(array(
        "config_sort"       => $config_sort,
    ));
    //////

    // selectsort
    $t->assign(array(
        "selectsort"       => $SELECTSORT,
    ));
    //////

    $quicklaunch = array();
    $sql = "SELECT aq.*, s.value as name_color_value, s.name as name_color_name
            FROM ".DB_TABLE_ADMIN_QUICKLAUNCH." aq
                LEFT JOIN ".DB_TABLE_SELECT." s ON s.id=aq.name_color
            WHERE admin_id=".$ADMIN['mid']."
            ORDER BY aq.rank,aq.id";
    $result = &$db->Execute($sql);
    if (!$result) {
        echo $db->ErrorMsg();
    } else {
        while (!$result->EOF) {
            $quicklaunch[] = array(
                'id'                => $result->fields['id'],
                'name'              => $result->fields['name'],
                'name_color'        => $result->fields['name_color'],
                'name_bold'         => $result->fields['name_bold'],
                'url'               => $result->fields['url'],
                'time'              => $result->fields['time'],
                'rank'              => $result->fields['rank'],
                'name_color_value'  => $result->fields['name_color_value'],
                'name_color_name'   => $result->fields['name_color_name'],
            );
            $result->MoveNext();
        }
    }
    $t->assign(array(
        "quicklaunch"   => $quicklaunch,
    ));
}
//////
?>
